home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / cpp_libs / sos3-2.lha / src / knl / knl.sos < prev   
Text File  |  1991-10-29  |  4KB  |  154 lines

  1. /* --------------------------------------------------------------------------
  2.  * Copyright 1992 by Forschungszentrum Informatik (FZI)
  3.  *
  4.  * You can use and distribute this software under the terms of the licence
  5.  * you should have received along with this program.
  6.  * If not or if you want additional information, write to
  7.  * Forschungszentrum Informatik, "STONE", Haid-und-Neu-Strasse 10-14,
  8.  * D-7500 Karlsruhe 1, Germany.
  9.  * --------------------------------------------------------------------------
  10.  */
  11. /* ************************************************************************ */
  12. /*                             SOS kernel classes                           */
  13. /* **************************** ************** **************************** */
  14.  
  15. schema knl
  16.  
  17. {
  18. extern void (0);
  19.  
  20. extern sos_Int (4);
  21. extern sos_Char (1);
  22.  
  23. extern sos_Cstring (4);
  24. extern sos_Pointer (4);
  25.  
  26. extern sos_Container (4);
  27.  
  28. extern sos_Id (8);
  29. extern sos_Offset (4);
  30.  
  31. enum sos_Bool          { FALSE, TRUE };
  32. enum sos_Eq_kind     { EQ_STRONG, EQ_WEAK };
  33. enum sos_Comp_result { CMP_LESS, CMP_EQUAL, CMP_GREATER };
  34.  
  35.  
  36. // ***************************    sos_Object    ****************************
  37.  
  38. class sos_Object
  39. {
  40. public:
  41.    sos_Type       type ();
  42.    sos_Bool       has_type (sos_Type);
  43.    sos_Bool       isa (sos_Type);
  44.    sos_Bool       is_some (sos_Type);
  45.    sos_Bool       is_value ();
  46.    sos_Int        size ();
  47.  
  48.    sos_Bool       identical (sos_Object);
  49.    sos_Bool       operator== (sos_Object);
  50.    sos_Bool       operator!= (sos_Object);
  51.    sos_Bool       like (sos_Object);
  52.    sos_Comp_result compare_ids (sos_Object);
  53.  
  54. protected:
  55.    static void     local_assign (sos_Object, sos_Object);
  56.    static sos_Bool local_equal (sos_Object, sos_Object, sos_Eq_kind);
  57.    static sos_Int  local_hash_value (sos_Object);
  58.  
  59. private:
  60.    sos_Id   type_id;
  61.  
  62. }; // ** sos_Object **
  63.  
  64.  
  65. // ***********************    sos_Ordered_object    ************************
  66.  
  67. class sos_Ordered_object
  68. {
  69. public:
  70.    abstract sos_Comp_result compare (sos_Ordered_object);
  71.  
  72.    sos_Bool operator<  (sos_Ordered_object);
  73.    sos_Bool operator<= (sos_Ordered_object);
  74.    sos_Bool operator>  (sos_Ordered_object);
  75.    sos_Bool operator>= (sos_Ordered_object);
  76.  
  77. }; // ** sos_Ordered_object **
  78.  
  79.  
  80. // ***********************    sos_Scalar_object    *************************
  81.  
  82. class sos_Scalar_object
  83. {
  84. protected:
  85.    static void     local_initialize (sos_Scalar_object);
  86.    static void     local_finalize (sos_Scalar_object);
  87.    static void     local_assign (sos_Scalar_object, sos_Object);
  88.    static sos_Bool local_equal (sos_Scalar_object, sos_Object, sos_Eq_kind);
  89.    static sos_Int  local_hash_value (sos_Scalar_object);
  90.  
  91. }; // ** sos_Scalar_object **
  92.  
  93.  
  94. // ****************************   sos_String   *****************************
  95.  
  96. class sos_String : sos_Ordered_object
  97. {
  98. public, private set:
  99.    sos_Int length;
  100.  
  101. public:
  102.    sos_Cstring    make_Cstring ();        // converts to an sos_Cstring
  103.    void        assign_Cstring (sos_Cstring);    // assigns an sos_Cstring
  104.  
  105.    void       operator+= (sos_String);    // appends an sos_String
  106.  
  107.    // ** Redefinitions **
  108.  
  109.    sos_Int           size ();             // (-> sos_Object)
  110.    sos_Comp_result compare (sos_Ordered_object); // (-> sos_Ordered_object)
  111.  
  112. protected:
  113.    static void     local_initialize (sos_String);
  114.    static void     local_finalize (sos_String);
  115.  
  116.    static void     local_assign (sos_String, sos_Object);
  117.    static sos_Bool local_equal (sos_String, sos_Object, sos_Eq_kind);
  118.    static sos_Int  local_hash_value (sos_String);
  119.  
  120. private:
  121.    sos_Offset address;
  122.  
  123. }; // ** sos_String **
  124.  
  125.  
  126. // ***************************    sos_Named    *****************************
  127.  
  128. class sos_Named
  129. {
  130. public:
  131.    abstract sos_String    get_name ();
  132.    abstract void    set_name (sos_String);
  133.  
  134. }; // ** sos_Named **
  135.  
  136.  
  137. // ****************************    sos_Type    *****************************
  138.  
  139. class sos_Type : sos_Named
  140. {
  141. public:
  142.    sos_String    name;
  143.    sos_Int      object_size;
  144.  
  145.    sos_Bool     is_derived_from (sos_Type);
  146.    sos_Bool     is_derived_from_some (sos_Type);
  147.    sos_Bool     is_scalar ();
  148.    sos_Type     base ();
  149.    sos_Type     root ();
  150.  
  151. }; // ** sos_Type **
  152.  
  153. } // ** schema knl **
  154.